All governments lend back and forth among official entities so their gross debt is bigger than the net debt held by non-government investors, and Japan does more of this than other developed lands.
In a declining economy, intelligent investors allocate most of their funds into government debt and non-cyclical equities, examining carefully the economic and financial conditions of each corporation they consider including in their portfolio.